#pragma once

#include "fxcc/core/graph/opengl3/Texture.h"
#include "fxcc/core/graph/common/Texture2DJack.h"

namespace fxcc
{
	namespace graph
	{
		namespace opengl3
		{

			struct FXCC_API  Texture2DJack :public fxcc::graph::opengl3::Texture, public common::Texture2DJack
			{

				Texture2DJack() :fxcc::graph::opengl3::Texture(GL_TEXTURE_2D), common::Texture2DJack()
				{
				}

				Texture2DJack(const fxcc::graph::common::Texture2DJack::Desc& desc);

				void Load();

				bool Init();

				bool InitDDS();

				bool InitWIC();

				bool InitAlloc();

				ImTextureID GetTextureId() const
				{
					return (ImTextureID)m_Id;
				}

				std::string SaveImage(const std::string& nameNoSuffix, int level = 0) const ;

				std::string SaveAsHDR(const std::string& hdrPath, int level = 0) const ;

				std::string SaveAsBMP(const std::string& bmpPath, int level = 0) const ;

				bool SimpleSaveDDS(const std::string& ddsPath);

				bool CreateDDSMipmapFromLevel0(const std::string& ddsPath, int levels, bool generateMipmap = false);
				
				bool CreateDDSMipmap(const std::string& ddsPath);

				void SetShader(int index) const override;

				static void UnBind()
				{
					glBindTexture(GL_TEXTURE_2D, 0);
				}


			};
		}
	}
}